#ifndef SOURCEMANAGER_H
#define SOURCEMANAGER_H

#include <QObject>
#include <QStringList>
#include <QtDebug>


class TextPosition
{
private:
	qint32 _row;
	qint32 _col;

public:
	TextPosition() : _row(0), _col(0) {}
	TextPosition(qint32 r, qint32 c) : _row(r), _col(c) {}
	~TextPosition(){}

	qint32 row(){ return _row; }
	qint32 at(){ return _col; }

	void toNextRow(){ ++_row; _col = 0; }
	void toNextChar() { ++_col; }

	void reset() { _row = 0; _col = 0; }
	void reset_at() { _col = 0; }
};

class SourceManager : public QObject
{
	Q_OBJECT

public:
	SourceManager(QObject *parent = 0);
	SourceManager(QString& source, QObject *parent = 0);
	~SourceManager();

	void setSource(QString &source);

	char nextChar();
	TextPosition position();	

private:
	bool nextLine();	
	void test();

private:
	QStringList code;			// tresc programu	
	TextPosition curr_pos;		// pozycja w tresci programu	
	bool start;
};

#endif // SOURCEMANAGER_H
